﻿using System;
using ASPNETVN.PORTAL.Components.UI;
using System.Web.UI;

namespace ASPNETVN.PORTAL.Modules.PhotoAlbum.Controls
{
    public partial class ImageSlideshow : ModulePage
    {
        protected string GetFilePath(string filename)
        {
            string uploadPath = this.ParentControl.Settings["UploadPath"].ToString();
            return string.Format("~/" + uploadPath + "/PhotoAlbum/{0}/{1}", this.ModuleID, filename);
        }

        protected string GetThumbnailFilePath(string filename)
        {
            string uploadPath = this.ParentControl.Settings["UploadPath"].ToString();
            return string.Format("~/" + uploadPath + "/PhotoAlbum/{0}/Thumbnails/{1}", this.ModuleID, filename);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            string scriptUrl = ResolveClientUrl("~/Scripts/ImageSlideshow/ImageSlideshow.js");
            string scriptName = "ImageSlideshowScript";
            Type scriptType = this.GetType();
            ClientScriptManager csm = Page.ClientScript;
            if (!csm.IsClientScriptIncludeRegistered(scriptType, scriptName))
            {
                csm.RegisterClientScriptInclude(scriptType, scriptName, scriptUrl);
            }                        
            /*
            HtmlLink cssLink = new HtmlLink();
            cssLink.Href = Global.ApplicationPath + "/Modules/PhotoAlbum/StyleSheets/ImageSlideshow.css";
            cssLink.Attributes.Add("rel", "stylesheet");
            cssLink.Attributes.Add("type", "text/css");
            Page.Header.Controls.Add(cssLink);
            */
        }
    }
}